#include <stdio.h>

#define MAX_SIZE 41

int seed_color(int a[MAX_SIZE][MAX_SIZE], int x, int y, int m, int n) 
{
	if (x >= 1 && x <= n && y >= 1 && y <= m && a[y][x] != 1 && a[y][x] != 2) {
		a[y][x] = 2;
		seed_color(a, x-1, y, m, n);
		seed_color(a, x+1, y, m, n);
		seed_color(a, x, y-1, m, n);
		seed_color(a, x, y+1, m, n);
	}
	return 0;
}

int main(int argc, char *argv[])
{
	int i, j, a[MAX_SIZE][MAX_SIZE], x0, y0, x1, y1, m, n;

	scanf("%d %d", &m, &n);
	for (i=1; i<=m; i++) {
		for (j=1; j<=n; j++) {
			scanf("%d", &a[i][j]);
		}
	}
	scanf("%d %d", &y0, &x0);
	scanf("%d %d", &y1, &x1);

	seed_color(a, x0, y0, m, n);

	if (a[y1][x1] == 2) {
		printf("OK!");
	} else {
		printf("NO!");
	}

	return 0;
}
